<template>
  <el-form-item :class="attributes?.customClassName?.formItemClassName ?? ''" v-bind="attributes.formItem" v-if="!attributes.isHidden()">
      <template
          v-for="item in attributes?.formItem?.slotScope ?? []"
          :key="item.slotName"
          v-slot:[item.slotName]="scope">
          <component :is="item.render(scope)" />
      </template>
      <el-input-number
          v-model="selectValue"
          :disabled="typeof (attributes.disabled) === 'function' ? attributes.disabled() : attributes.disabled"
          :class="attributes?.customClassName?.elModelClassName ?? ''"
          v-bind="attributes.elModel">
          <template
                  v-for="item in attributes?.elModel?.slotScope ?? []"
                  :key="item.slotName"
                  v-slot:[item.slotName]="scope">
              <component :is="item.render(scope)" />
          </template>
      </el-input-number>
  </el-form-item>
</template>

<script setup>
import { computed } from 'vue'

const props = defineProps({
    value: {
        type: [String, Number, Boolean, Date, Array],
        required: true
    },
    attributes: {
        type: Object,
    default: () => ({})
}
})
const emit = defineEmits(['push-val'])
const selectValue = computed({
    get() {
        return props.value
    },
    set(val) {
        emit('push-val', val)
    }
})
</script>

<style scoped>

</style>